<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>乐淘首页</title>
    <link rel="stylesheet" href="./lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="./lib/bootstrap-validator/css/bootstrapValidator.min.css">
    <link rel="stylesheet" href="./lib/nprogress/nprogress.css">
    <link rel="stylesheet" href="./css/common.css">
</head>

<body>
    <div class="lt-aside ">
        <div class="brand"><a href="#">黑马商城</a></div>
        <div class="user">
            <img src="./images/default.png" alt="">
            <p>超级管理员</p>
        </div>
        <div class="nav">
            <ul>
                <li><a href="user.html"><i class="glyphicon glyphicon-user"></i> 用户管理</a></li>
                <li>
                    <a href="javascript:;" class="category"><i class="glyphicon glyphicon-list"></i>分类管理</a>
                    <div class="child  my-hide">
                        <a href="first.html">一级分类</a>
                        <a href="second.html">二级分类</a>
                    </div>
                </li>
                <li><a href="product.html"><i class="glyphicon glyphicon-tags"></i>商品管理</a></li>
            </ul>
        </div>
    </div>
    <div class="lt-main pl-180">
        <div class="lt-top pl-180">
            <a href="#" class="pull-left icon_menu"><i class="glyphicon glyphicon-align-justify  "></i></a>
            <a href="#" class="pull-right icon_logout"><i class="glyphicon glyphicon-log-out"></i></a>
        </div>
        <div class="lt-content">
            <!-- 路径导航 -->
            <ol class="breadcrumb">
                <li><a href="#">后台管理</a></li>
                <li>分类管理</li>
                <li class="active">商品管理</li>
            </ol>
            <!-- data-target='.modal-add' data-toggle="modal" 🐾神奇的属性 data()获取自定义属性 -->
            <button class="btn btn-default mb_20 ml-20" id="addBtn" data-target='.modal-add'
                data-toggle="modal">添加商品</button>
            <table class="table table-bordered table-hover ">
                <thead>
                    <tr>
                        <th width='10%'>序号</th>
                        <th width='20%'>商品名称</th>
                        <th width='20%'>商品描述</th>
                        <th width='10%'>商品库存</th>
                        <th width='10%'>商品尺寸</th>
                        <th width='10%'>商品状态</th>
                        <th width='20%'>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!-- 模板引擎动态渲染数据 -->
                   
                </tbody>
            </table>
            <div class="pull-right">
                <ul id="paginator"></ul>
            </div>
        </div>
    </div>
    <!--添加分类的模态框 -->
    <div class="modal fade modal-add" id="addModal">
        <div class="modal-dialog ">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">添加商品</h4>
                </div>
                <div class="modal-body">
                    <form id="form" class="add-form">
                        <div class="form-group">
                            <div class="dropdown">
                                <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
                                    <span id="dropdownText"  class="cate-title">请选择二级分类</span>
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu two-list">
                                    <!-- 模板渲染数据 -->
                                </ul>
                            </div>
                            <input type="hidden" name="brandId">
                        </div>

                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入商品名称" name="proName">
                        </div>
                        <div class="form-group">
                            <textarea class="form-control" placeholder="请输入商品描述" name="proDesc"></textarea>
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入商品库存" name="num">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入商品尺码" name="size">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入商品原价" name="oldPrice">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入商品现价" name="price">
                        </div>

                        <div class="form-group">
                            <label class="btn btn-default " for="fileupload">上传图片</label>
                            <!-- 1. 指定name用于让后台获取图片, 所以不能乱写 -->
                            <!-- 2. 指定data-url, 指定接口地址 -->
                            <input id="fileupload" type="file" name="pic1" data-url="/product/addProductPic"
                                style="display: none;" multiple>
                        </div>

                        <div class="form-group" id="imgBox">
                            <input type="hidden" name="picArr" id="picArr">

                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary" id="submitBtn" form='form'>添加</button>
                </div>
            </div>
        </div>
    </div>
    <script type="text/html" id="tmp">
        {{each rows v i}}
        <tr>
             <td width='10%'>{{ (page-1)*size + i+1 }}</td>
             <td width='20%'>{{ v.proName }}</td>
             <td width='20%'>{{ v.proDesc }}</td>
             <td width='10%'>{{ v.num }}</td>
             <td width='10%'>{{ v.size }}</td>
             <td width='10%'>{{ v.statu === 1 ? "已上架" : "已下架" }}</td>
             <td width='20%'>
                 {{ if v.statu === 1}}
                 <a href="#" class="btn btn-danger">下架</a>
                 {{ else }}
                 <a href="#" class="btn btn-success">上架</a>
                 {{ /if }}
            </td>
        </tr>
        {{ /each }}
    </script>
    <script type='text/html' id='dropdownTmp'>
        {{ each rows v i}}
            <li><a href="#" data-id='{{ v.id }}'>{{ v.brandName }} </a></li>
        {{ /each }}
    </script>

    <script src="./lib/jquery/jquery.min.js"></script>
    <script src="./lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="./lib/bootstrap-validator/js/bootstrapValidator.min.js"></script>
    <script src="./lib/nprogress/nprogress.js"></script>
    <script src="./lib/echarts/echarts.min.js"></script>
    <script src="./lib/artTemplate/template-web.js"></script>
    <script src="./lib/bootstrap-paginator/bootstrap-paginator.min.js"></script>
    <script src="./lib/jquery-fileupload/jquery.ui.widget.js"></script>
    <script src="./lib/jquery-fileupload/jquery.iframe-transport.js"></script>
    <script src="./lib/jquery-fileupload/jquery.fileupload.js"></script>
    <script src="./js/product.js"></script>
    <script src="./js/common.js"></script>
</body>

</html>